<%@ page contentType="text/html;charset=utf-8" language="java"
	pageEncoding="UTF-8" import="java.util.Date"%>
<%@include file="../../common/mastertopedit.jsp"%>
<input type="hidden" id="roleId" value="${model.role.id}"> 
  <div class="form-horizontal pt-15  form-clean-magin"> 
  	<div class="form-group">
			<label for="inputEmail3"
				class="col-xs-3 text-right control-label usual-label">角色名称</label>
			<div class="col-xs-9">
				<input  type="text"
					class="form-control form-control-260 pull-left"
					 id="roleName"     value="${model.role.roleName}" >
					<i class="plum-sign-right">*</i>
			</div>
		</div>
		
	<div class="form-group">
		<label for="inputEmail3"
			class="col-xs-3 text-right control-label usual-label">备注说明</label>
		<div class="col-xs-9">
			<textarea class="form-control form-control-260 pull-left" id="remark"
				rows="5" style="height: 100px;">${model.role.remark}</textarea>
		</div>
	</div>
  </div>
  
  <div class="form-group text-center">
		<button type="button" class="runmi-btn runmi-primary"
			onclick="backIndex()">取消</button>
		<button type="button" class="runmi-btn runmi-sure-btn"
			onclick="save()">保存</button>
	</div>
   
  <script type="text/javascript">
  function save(){
		var postData="&roleId=" +$('#roleId').val() ;
		
		var roleName=$('#roleName').val();
		if(roleName==''){
			layer.alert('请输入角色名称');
	    	return;
		}
		postData=postData + "&roleName=" + encodeURIComponent(roleName);
		
		var remark=$('#remark').val();
		postData=postData + "&remark=" + encodeURIComponent(remark);
			
		
	    layer.load(1, {shade: [0.5,'#fff']});
	   // alert(postData);
	    $.ajax({
	        type: "POST",
	        url: "saveRole",
	        data: postData,
	        contentType: "application/x-www-form-urlencoded;charset=UTF-8",
	        async: true, // 同步  true 异步。默认是异步
	        dataType: 'json',
	        error: function(resultdata) {
	        	layer.closeAll();
	        },
	        success: function(resultdata) {
	        	layer.closeAll();
	            if(resultdata.returnCode=="0000"){               	
	            	layer.alert('操作成功',{icon: 1}, function(){
	            	 	 parent.editReturn();
	            		//layer.closeAll(); 
	            		 //layer.closeAll();
	            		//window.location.href="${pageContext.request.contextPath}/distrbutor/inventory/index";
	            	});
	            }else{
	            	layer.alert(resultdata.returnMessage);
	            }
	        }
	    });
	}
  function backIndex(){	  
 	 parent.editReturn();
  }
	</script>
<%@include file="../../common/masterbottom.jsp"%>
